import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;


public class Metadata
{
    private static Metadata instance = new Metadata();
   
    private ConcurrentHashMap<String, ComputeNode> computeNodes = new ConcurrentHashMap<String, ComputeNode>();
    private ArrayList<Application> apps = new ArrayList<Application>();
    private String current_cn_image = "ami-943591fd";
    
    public ConcurrentHashMap<String, ComputeNode> getComputeNodes()
    {
        return computeNodes;
    }

    public ArrayList<Application> getApps()
    {
        return apps;
    }

    private Metadata()
    {
        
    }
    
    static public Metadata getInstance()
    {
        return instance;
    }

    public String getCurrent_cn_image()
    {
        return current_cn_image;
    }

    public void setCurrent_cn_image(String current_cn_image)
    {
        this.current_cn_image = current_cn_image;
    }
}

class ComputeNode
{
    String hostname;
    double cpu_percent;
    int sessions;
    
    synchronized public int getSessions()
    {
        return sessions;
    }

    synchronized public void setSessions(int sessions)
    {
        this.sessions = sessions;
    }

    public ComputeNode(String hostname)
    {
        this.hostname = hostname;
        cpu_percent = 0;
        sessions = 0;
    }
}

class Application
{
    public Application(String filename, String command, int port)
    {
        this.filename = filename;
        this.command = command;
        this.port = port;
    }
    String filename;
    String command;
    int port;
}
